home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacHack 1996
/
MacHack 1996.toast
/
Presentations
/
Presentations ’94
/
Timothy Knox
/
Pocket6.3
/
Source
/
Interface.txt
< prev
next >
Wrap
Text File
|
1994-06-24
|
18KB
|
632 lines
; Interface.txt -- interface routines 3:37:12 PM 2/4/87
; Fri Jan 22, 1988 12:52:12 version 0.3
; Fri Feb 12, 1988 13:35:10 3+ menus
; Wed Mar 30, 1988 13:37:36 'newer' routine
; Thu Apr 07, 1988 16:00:59 nested loads
; Mon Apr 18, 1988 14:06:09 restructure variables, echo
; Sun May 01, 1988 10:38:11 fix emptyFS to skip nil handles
; Mon May 27, 1991 17:41:00 use wne based event loop and zoomin&out handlers
; Fri May 30, 1991 05:09:00 handler for "high level events"
; Sun Apr 12, 1992 22:48:00 move tib and userVars from ainterp
; Sun Apr 19, 1992 23:24:00 apple events
; Fri Jan 22, 1993 19:28:00 fix KEYEVT
; Sun Jul 04, 1993 07:55:00 0.6.3
theWindow: DC.L 0 ; pointer ( 0 +md )
WContRect: DC.W 0,0 ; ( 4 +md )
WSize: DC.W WHeight,WWidth ; ( 8 +md )
Activate: DC.W drop-Base ; ( 12 +md )
Update: DC.W curs-Base ; ( 14 +md )
Button: DC.W beep-Base ; ( 16 +md )
YourMenu: DC.W menus-Base ; ( 18 +md )
Runner: DC.W null-Base ; ( 20 +md )
Closer: DC.W bye-Base ; ( 22 +md )
About: DC.W doabout-base ; ( 24 +md )
Newer: DC.W null-base ; ( 26 +md )
Echo: DC.W -1 ; ( 28 +md )
AppleMenu: DC.L 0 ; ( 30 +md )
FileMenu: DC.L 0 ; ( 34 +md )
EditMenu: DC.L 0 ; ( 38 +md )
TextO: DC.L 0 ; TextOffset ( 42 +md )
TextE: DC.L 0 ; TextEnd
TextH: DC.L 0 ; TextHandle
FStack: DCB.L 5,0 ; text block handles
FOfsets: DCB.L 5,0 ; text block offsets
FEnds: DCB.L 5,0 ; text block ends
FSPtr: DC.W -4 ; file stack pointer
Events: DC.W Null-Base ; 0. Null Event ( 116 +md )
DC.W BDEvt-Base ; 1. Mouse button down ( 118 +md )
DC.W Null-Base ; 2. Mouse button up ( 120 +md )
DC.W KeyEvt-Base ; 3. Key down ( 122 +md )
DC.W Null-Base ; 4. Key up ( 124 +md )
DC.W KeyEvt-Base ; 5. Auto key ( 126 +md )
DC.W UDEvt-Base ; 6. Update window ( 128 +md )
DC.W Null-Base ; 7. Disk inserted event ( 130 +md )
DC.W ActEvt-Base ; 8. Activate window ( 132 +md )
DC.W Null-Base ; 9. reserved ( 134 +md )
DC.W doAEvent-Base ; A. do AppleEvent ( 136 +md )
DC.W Null-Base ; B. I/O driver ( 138 +md )
DC.W Null-Base ; C. Undefined1 ( 140 +md )
DC.W Null-Base ; D. Undefined2 ( 142 +md )
DC.W Null-Base ; E. Undefined3 ( 144 +md )
DC.W MFEvt-Base ; F. mouse & suspend/resume ( 146 +md )
EventRecord:
What: DC.W 0 ; WhatEvent# ( 148 +md )
Message: DC.W 0 ; key code, wptr, etc. ( 150 +md )
ASCII: DC.W 0 ; ASCII code ( 152 +md )
When: DC.L 0 ; Ticks since startup ( 154 +md )
Where: ; Mouse coordinates ( 158 +md )
V: DC.W 0
H: DC.W 0
Modify: DC.W 0 ; State of modifier keys ( 162 +md )
WWindow: DC.L 0 ; WindowPtr from FindWindow ( 164 +md )
Clicks: DC.W Null-Base ; InDesk ( 168 +md )
DC.W MenuBar-Base ; InMenu Bar ( 170 +md )
DC.W DARgn-Base ; InSystem Window ( 172 +md )
DC.W ContentRgn-Base ; InContent region ( 174 +md )
DC.W DragRgn-Base ; InDrag region ( 176 +md )
DC.W Null-Base ; InGrow region ( 178 +md )
DC.W CloseRgn-Base ; ByeByeBox ( 180 +md )
DC.W beep-base ; inZoomIn ( 182 +md )
DC.W beep-base ; inZoomOut ( 184 +md )
MFlag: DC.W 0 ; true if multitasking ( 186 +md )
AEvents: DC.W ae1-base ; address of first AEentry ( 188 +md )
AError: DC.W drop-base ; process AEerror number ( 190 +md )
KFlag: DC.W 0 ; key flag ( 192 +md )
doneFlag: DC.W 0 ; done flag ( 194 +md )
openFlag: DC.W 0 ; open flag ( 196 +md )
AEReply: DC.L 0 ; Apple Event Reply ( 198 +md )
AEEventRecord: DC.L 0 ; Apple Event Event Record ( 202 +md )
; addresses beyond this are not documented relative to +md
oldIdle: DC.W 0
Desc: DC.L 0,0
Scratch: DC.L 0
SaveAERegs: DC.L 0,0,0,0 ; Dict,DP,IS,PS
BigRect: DC.W $8000,$8000,$7FFF,$7FFF ; for dragging
ae1: DC.L 'aevt'
DC.L 'oapp'
DC.W aenull-base
DC.W ae2 -base
ae2: DC.L 'aevt'
DC.L 'odoc'
DC.W aeopen-base
DC.W ae3 -base
ae3: DC.L 'aevt'
DC.L 'pdoc'
DC.W aenull-base
DC.W ae4 -base
ae4: DC.L 'aevt'
DC.L 'quit'
DC.W aebye-base,0
Menus: DC.W Fmenu-base
DC.W Emenu-base
Fmenu: DC.W open-base ; Open…
DC.W null-base ; -
DC.W csave-base ; Save
DC.W mon-base ; Debug
DC.W null-base ; -
DC.W beep-base ; Print
DC.W null-base ; -
DC.W by-base ; Quit
Emenu: DC.W beep-base ; Undo
DC.W null-base ; -
DC.W beep-base ; Cut
DC.W beep-base ; Copy
DC.W paste-base ; Paste
DC.W beep-base ; Clear
; addresses beyond this are relative to tib
TermBuf DCB.B 82,32 ; command line buffer ( 0 tib + )
; User variable data
StackSize: DC.W 2048 ; variable stack size ( 82 tib + )
IntA7: DC.L 0 ; initial value for A7 ( 84 tib + )
Rzero: DC.L 0 ; value for A7 after linking ( 88 tib + )
Szero: DC.L 0 ; bottom of stack ( 92 tib + )
Form: DC.L $FFFF0007 ; decaform record ( 96 tib + )
Expand: DC.L 0 ; hold address of expand routine ( 100 tib + )
FreePt: DC.W dictend-Base ; initial compile point freespace ( 104 tib + )
FreeSz: DC.W base+32767-dictend ; max headroom ( 106 tib + )
DictPt: DC.W task-theLink ; initial dict. search start ( 108 tib + )
NBase: DC.W 10 ; the numeric radix ( 110 tib + )
Held: DC.W 0 ; the HLD data ( 112 tib + )
DoesAddr: DC.L 0 ; "does>" jump address ( 114 tib + )
fcolon: DC.B 0 ; compile mode ( 118 tib + )
fimmed: DC.B 0 ; immediate flag ( 119 tib + )
fneg: DC.B 0 ; negative flag ( 120 tib + )
fint: DC.B $80 ; interactive mode ( 121 tib + )
fmacro: DC.W 0 ; macro flag+filler ( 122 tib + )
; ----- Startup Code -----
MacStart: ; load the menus, setup a window and create a data block
MOVEQ #1,D3
@0: CLR.L -(SP) ; room
MOVE D3,-(SP) ; Push menu ID
_GetRMenu ; Get menu from resource.
MOVE D3,D0
SUBQ #1,D0
ASL #2,D0
LEA AppleMenu,A0 ; menu handle data area
MOVE.L (SP),0(A0,D0.W) ; Save it.
CLR -(SP) ; Push a 0 for append.
_InsertMenu
ADDQ #1,D3
CMP #4,D3
BNE.S @0 ; do the next menu
MOVE.L AppleMenu,-(SP)
MOVE.L #'DRVR',-(SP) ; Load all DRVR resource types.
_AddResMenu ; Add the DA's.
_DrawMenuBar
; create a window
CLR.L -(SP) ; make room for the new window pointer
MOVE #128,-(SP) ; WIND ID
CLR.L -(SP) ; put it on the heap
MOVE.L #-1,-(SP) ; behind none
MOVE.L #'qd ',-(PS)
JSR qgestalt-base(BP)
TST (PS)+
BEQ.S @1
MOVE.L (PS)+,D0
CMP #$100,D0
BLT.S @1
_GetNewCWindow
BRA.S @2
@1: _GetNewWindow
@2: MOVE.L (SP),theWindow-base(BP)
MOVE.L (SP),-(SP)
MOVE.L WSize-base(BP),-(SP)
CLR.W -(SP)
_SizeWindow
MOVE.L (SP),-(SP)
_ShowWindow
_SetPort
; create a temp scrap holder
MOVE.L #10,D0 ; this is just a size
_NewHandle ; create a handle
MOVE.L A0,TextH-base(BP) ; to hold clipboard data
; Check for multitasking environment
CLR MFlag-base(BP) ; set MFlag to 0
MOVE.W #$A89F, D0 ; _Unimplemented
_GetTrapAddress ; NGetTrapAddress
MOVE.L A0,D1
MOVE.W #$A860,D0 ; _WaitNextEvent
_GetTrapAddress ; NGetTrapAddress
CMP.L A0,D1
BEQ.S @3 ; no multitasking
MOVE.W #$100,MFlag-base(BP) ; set multitasking flag
; install apple event handlers if running system 7
@3: MOVE.L #'evnt',-(PS)
JSR QGestalt-base(BP)
TST (PS)+ ; check for gestalt
BEQ.S @5 ; no gestalt, just return
SUBQ.L #1,(PS)+ ; check for apple events present
BNE.S @5 ; no apple events, just return
MOVE AEvents-base(BP),D0 ; start rel addr of the events list
@4: LEA 0(BP,D0.W),A4 ; start addr of an item
CLR -(A7) ; result
MOVE.L (A4),-(A7) ; push event class
MOVE.L 4(A4),-(A7) ; push event selector
MOVE 8(A4),D0 ; get rel addr of handler
PEA 0(BP,D0.W) ; push abs addr of handler
PEA (BP) ; push refcon
CLR -(A7) ; not syshandler
_AEInstallEvent ; INSTALL EACH EVENT IN THE LIST
TST (A7)+ ; drop result
MOVE 10(A4),D0 ; get rel addr of next item
BNE.S @4 ; a zero indicates done
@5: RTS
; ----- Event Loop ------
doDone: MOVEA.L intA7-base(BP),A7 ; *** quit PocketForth ***
RTS
doOpen: CLR openFlag-base(BP)
JMP doload-base(BP)
NextEvent:
CLR KFlag-base(BP) ; clear the key flag
CLR -(SP) ; turn all menus white
_HiLiteMenu
TST doneFlag-base(BP)
BNE.S dodone
TST openFlag-base(BP)
BNE.S doopen
MOVE Runner-base(BP),D0
JSR 0(BP,D0.W) ; run the idle routine
clr.l -(sp)
subq #1,(sp)
PEA EventRecord-base(BP) ; event record to be filled
TST MFlag-base(BP) ; running multitasking?
BNE.S @1 ; if not, do SystemTask/GetNextEvent
_SystemTask ; handle DA's, etc.
_GetNextEvent ; fill the event record
BRA.S @2
@1: CLR.L -(SP) ; 0 sleep ticks
CLR.L -(SP) ; nil mouse region
_WaitNextEvent ; get multitasking event
@2: TST (SP)+ ; Is this an event?
BEQ.S rdr ; no this is a non-event
MOVE What-base(BP),D0 ; check the event number
CMPI #23,D0 ; is it a HighLevelEvent?
BNE.S @3
MOVEQ #10,D0 ; remap HLEs to event 10 (IM VI5-12)
@3: LEA Events-base(BP),A0
hop1: ADD D0,D0 ; Calculate and jump to the ...
MOVE 0(A0,D0.W),D0 ; ... rel addr of the routine ...
hop2: JMP 0(BP,D0.W) ; ... in the Events list.
; -- Mouse Down Event --
BDEvt: CLR -(SP) ; Result of find window
MOVE.L Where-base(BP),-(SP) ; Mouse point of click.
PEA WWindow-base(BP) ; Var. for pointer of clicked wind.
_FindWindow ; Returns window region code ...
CLR.L D0 ; ... (see p. WM-27 in IM).
MOVE (SP)+,D0 ; Pop part number
LEA Clicks-base(BP),A0 ; clicks is an array of rel.addrs
BRA.S hop1
MenuBar:
CLR.L -(SP) ; Make room for menu choice data.
MOVE.L Where-base(BP),-(SP) ; Mouse coordinates of click.
_MenuSelect ; Get the selected Menu data.
MOVE.L (SP)+,-(PS) ; menu ID and item to pstack.
bra.s domenu
DARgn:
PEA EventRecord-base(BP)
MOVE.L WWindow-base(BP),-(SP)
_SystemClick
RTS
DragRgn:
MOVE.L WWindow-base(BP),-(SP) ; push The Window Pointer
MOVE.L Where-base(BP),-(SP) ; push The Mouse Coordinates
PEA BigRect-base(BP) ; The drag boundry limits
_DragWindow ; Drag it
rdr: RTS
CloseRgn:
CLR -(SP)
MOVE.L WWindow-base(BP),-(SP)
MOVE.L Where-base(BP),-(SP)
_TrackGoAway
MOVE (SP)+,D0
BEQ.S rdr
by: MOVE Closer-base(BP),D0 ; inital value: bye-base
BRA.S hop2
ContentRgn: ; select the clicked in window.
MOVE.L WWindow-base(BP),-(SP)
_SelectWindow
MOVE Button-base(BP),D0 ; inital value: beep-base
BRA.S hop2
; -- Key Down Event --
KeyEvt: _ObscureCursor
MOVE Message+2-base(BP),D0
AND #$FF,D0 ; D0 has the ASCII code of the key.
MOVE Modify-base(BP),D1
BTST #8,D1
BNE.S CommandKey
MOVE D0,kflag-base(BP)
@0: RTS
; Menu actions
CommandKey: ; handle the menu choices.
CLR.L -(SP) ; Room for menu data.
MOVE D0,-(SP) ; Push ASCII.
_MenuKey ; Get the menu data.
MOVE.L (SP)+,-(PS) ; menu ID and item to pstack.
DoMenu: ; Determine which menu was used.
TST 2(PS) ; is the item number = 0?
BEQ twodrop ; no menu selection, drop data
CMPI #1,(PS) ; Is it the Apple menu? ...
BEQ.S DoAppleMenu ; handle this special case
CMPI #3,(PS) ; Is it the Edit menu?
BNE.S @0 ; the last special case *
CLR.L -(SP) ; Check if it's a DA window
_FrontWindow
MOVE.L (SP)+,A0
TST $6C(A0) ; windowKind(FrontWindow)
BGE.S @0 ; negative=dawindow
TST (PS)+ ; drop the menu id
CLR -(SP)
MOVE (PS)+,-(SP) ; push item-1
SUBQ #1,(SP)
_SysEdit ; do the da edit stuff
TST (SP)+
RTS
@0: MOVE YourMenu-base(BP),D0 ; inital value:
LEA 0(BP,D0.W),A0 ; do a double indexed reference
MOVE (PS)+,D0
SUBQ #2,D0
ADD D0,D0
MOVE 0(A0,D0.W),D0
LEA 0(BP,D0.W),A0
MOVE (PS)+,D0
SUBQ #1,D0
JMP hop1-base(BP)
DoAppleMenu:
CLR (PS)+
MOVE (PS)+,D1
CMP #1,D1 ; Is it the first item?
BNE.S @0
MOVE about-base(BP),D0
JMP 0(BP,D0.W)
@0: PEA WWindow ; Its a DA
_GetPort
MOVE.L AppleMenu-base(BP),-(SP)
MOVE D1,-(SP)
PEA (A2) ; name at here
_GetItem
CLR -(SP)
PEA (A2)
_OpenDeskAcc
MOVE (SP)+,D0
MOVE.L WWindow-base(BP),-(SP)
_SetPort
RTS
DoAbout:
CLR -(SP) ; Room for which item number.
MOVE #257,-(SP) ; Resource ID of AboutDialog
CLR.L -(SP)
_Alert ; About Item
CLR (SP)+ ; Don't care which item dismissed.
RTS
; -- Update Event --
UDEvt: PEA WWindow-base(BP)
_GetPort
MOVE.L WWindow-base(BP),-(SP) ; push for _SetPort
MOVE.L Message-base(BP),-(SP) ; push wpointer for _EndUpdate
MOVE.L (SP),-(SP) ; push for _SetPort
MOVE.L (SP),-(SP) ; push for _BeginUpdate
_BeginUpdate ; restrict to invalid region
_SetPort ; specify this window
MOVE Update-base(BP),D0 ; inital value: curs-base
JSR 0(BP,D0.W) ; execute the draw routine
_EndUpdate ; go back to current cliprgn
_SetPort
RTS
; -- Activate Event --
ActEvt: CLR -(PS) ; modify has on/off flag in bit 0
BTST #0,Modify+1-base(BP)
act1: BEQ.S @0
SUBQ #1,(PS)
@0: MOVE Activate-base(BP),D0 ; inital value: drop
JMP 0(BP,D0.W)
; ---- Activate/Suspend ----
MFEvt: CLR -(PS)
TST message-base(BP)
BMI drop
BTST #0,message+3-base(BP)
BRA.S act1
; ---- High Level Event ----
DoAEvent:
MOVEM.L Dict/DP/IS/PS,saveAERegs-base(BP) ; send along PF's regs
CLR -(SP)
PEA eventRecord-base(BP)
_AEProcessAppleEvent
MOVE (SP)+,-(PS)
BEQ.S noaer
MOVE AError-base(BP),D0
JMP 0(BP,D0.W)
noaer: MOVEM.L saveAERegs-base(BP),Dict/DP/IS/PS ; update PF's regs
RTS
aepre: MOVEM.L (SP)+,A0/A1/BP
MOVE.L (SP)+,AEReply-base(BP) ; store reply
MOVE.L (SP)+,AEEventRecord-base(BP) ; store event record
CLR (SP) ; return no error
MOVE.L A1,-(SP) ; re-stack the return addr
MOVEM.L Dict/DP/IS/PS,-(SP) ; stash the system regs
MOVEM.L saveAERegs-base(BP),Dict/DP/IS/PS ; load PF regs
JMP (A0)
aenull: BSR.S aepre
aert: BSR.S aepost
RTS
aebye: BSR.S aepre
JSR by-base(BP)
BRA.S aert
aeopen: BSR.S aepre
BSR.S aeopn
BRA.S aert
aepost: MOVE.L (SP)+,A0
MOVEM.L Dict/DP/IS/PS,saveAERegs-base(BP) ; save PF regs
MOVEM.L (SP)+,Dict/DP/IS/PS ; restore the system regs
JMP (A0)
aeopn: CLR -(SP)
MOVE.L AEEventRecord-base(BP),-(SP)
MOVE.L #'----',-(SP)
MOVE.L #'list',-(SP)
PEA desc-base(BP)
_AEGetParamDesc
TST (SP)+
BNE.S @0
MOVE runner-base(bp),oldidle-base(BP)
MOVE #odocidle-base,runner-base(BP)
@0: RTS
OdocIdle: ; Open the document in the idle handler
MOVE oldIdle-base(bp),runner-base(BP) ; reset old handler
CLR -(SP)
PEA desc-base(BP)
CLR.L -(SP)
ADDQ.L #1,(SP) ; index = 1
MOVE.L #'fss ',-(SP) ; desired type
PEA 108(A2) ; keyword
PEA 112(A2) ; desc type
PEA 34(A2) ; data pointer
MOVE.L #70,-(SP)
PEA 104(A2)
_AEGetNthPtr ; Get fssPtr at here + 34
TST (SP)+ ; test for error
BNE.S @1
; clear out a buffer for working directory param. block
LEA 40+64+80(A2),A0
MOVE #19,D0
@0: CLR.L -(A0)
DBRA D0,@0
; calc working directory here
MOVE 34(A2),22(A0) ; -> ioVRefNum
MOVE.L 36(A2),48(A0) ; -> ioWDDirID
_OpenWD
MOVE 22(A0),-(PS) ; <- working directory
ADDQ #1,openFlag-base(BP)
@1: CLR -(SP) ; Be neat
PEA desc-base(BP)
_AEDisposeDesc
ADDQ.L #2,SP
RTS
; Pasting support
ClearTermBuf:
MOVEQ #76,D0
LEA TermBuf-base(BP),IS
@0: MOVE.L #$20202020,0(IS,D0) ; fill line buffer with blanks
SUBQ.B #4,D0
BGE.S @0
RTS
EmptyFS: ; clear pending loads from the file stack
TST fsptr-base(BP)
BMI.S @1
LEA fstack-base(BP),A1
MOVE fsptr-base(BP),D0
MOVE.L 0(A1,D0.W),A0 ; A0 has the next load block addr
MOVE.L A0,D1
BEQ.S @0 ; dont try to dispose of nil handle
CLR.L 0(A1,D0.W)
CMPA.L TextH-base(BP),A0
BEQ.S @0
_DisposHandle
@0: SUBQ #4,fsptr-base(BP)
BRA.S emptyfs
@1: RTS
Paste: JSR nocurs-base(BP)
CLR.L -(SP)
MOVE.L TextH-base(BP),-(SP) ; handle to the scrap data
MOVE.L #'TEXT',-(SP)
PEA TextO-Base(BP)
_GetScrap
MOVE.L (SP)+,TextE-base(BP) ; put the length at TextE
MOVE.L TextH-base(BP),A0 ; get a handle to the scrap data
MOVE.L (A0),D0 ; derefrence the scrap handle
MOVE.L D0,TextO-base(BP) ; set TextO to start of scrap data
ADD.L D0,TextE-base(BP) ; set TextE to end of scrap data
_HLock ; don't let data move during paste
CLR fsptr-base(BP)
MOVE.L TextH-base(BP),fstack-base(BP)
MOVE.L TextO-base(BP),fofsets-base(BP)
MOVE.L TextE-base(BP),fends-base(BP)
go: CLR.B fint-base(BP) ; leave keyboard mode
JMP CRet-base(BP) ; get next line
Pasting: ; GetInput comes here for input when fint-base(BP) is 0
JSR ClearTermBuf-base(BP)
CLR.L D1 ; clear the character count
CLR.L D0 ; and the character
MOVE.L TextO-base(BP),A0 ; set the input address
@0: MOVE.B 0(A0,D1.W),D0 ; BEGIN get a character
cmp.b #9,d0 ; skip over tabs
bne.s @1 ; by substituting spaces
moveq #bl,d0 ; in the input stream
@1: CMP.B #CR,D0 ; is it not a CR?
BEQ.S @2
CMPI.B #78,D1 ; or 78 characters in buffer
BGE.S @2 ; WHILE
MOVE.B D0,0(IS,D1) ; stash it into buffer
ADDQ.B #1,D1 ; increment count
BRA.S @0 ; REPEAT
@2: ADDQ.B #1,D1 ; increment count
MOVE.B #CR,0(IS,D1) ; stash CR into buffer
MOVE D1,-(PS) ; preserve count for TYPE
ADD.L TextO-base(BP),D1
MOVE.L D1,TextO-base(BP)
CMP.L TextE-base(BP),D1 ; IS the block done (TextO>TextE)?
BMI.S tandr ; just type and return if not.
MOVE fsptr-base(BP),D0
LEA fstack-base(BP),A0
MOVE.L 0(A0,D0.W),A0
_HUnlock ; unlock the block
BMI huh
CMPA.L TextH-base(BP),A0
BEQ.S @3 ; keep the scrap block
_DisposHandle ; dispose of loaded blocks
BMI huh
@3: SUBQ #4,fsptr-base(BP) ; pop fstack
BMI.S @4 ; branch if no pending loads
MOVE fsptr-base(BP),D0
LEA fofsets-base(BP),A0 ; set TextO to (fofsets+fsptr)
MOVE.L 0(A0,D0.W),TextO-base(BP)
LEA fends-base(BP),A0
MOVE.L 0(A0,D0.W),TextE-base(BP)
BRA.S tandr
@4: BSET.B #7,fint-base(BP) ; set keyboard mode
tandr: TST echo-base(BP)
BNE.S @5
JMP drop-base(BP)
@5: MOVE #termbuf-base,-(PS)
JSR swapp-base(BP)
JSR type-base(BP)
JMP doCR-base(BP) ; TIB count TYPE CR ;